package com.mjfeed.controller.admin;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.mjfeed.controller.BaseController;
import com.mjfeed.entity.Order;
import com.mjfeed.service.OrderService;

/**
 * @description 打印
 * @author zhaominglei
 * @date 2014年10月20日
 */
@Controller("adminPrintController")
@RequestMapping("/admin/print")
public class PrintController extends BaseController {
	@Resource(name="orderService")
	private OrderService orderService;
	
	/**
	 * 订单打印
	 */
	@RequestMapping(value = "/order", method = RequestMethod.GET)
	public String order(Long id, HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("order", orderService.getById(Order.class, id));
		return "/admin/print/order";
	}

	/**
	 * 购物单打印
	 */
	@RequestMapping(value = "/product", method = RequestMethod.GET)
	public String product(Long id, HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("order", orderService.getById(Order.class, id));
		return "/admin/print/product";
	}

	/**
	 * 配送单打印
	 */
	@RequestMapping(value = "/shipping", method = RequestMethod.GET)
	public String shipping(Long id, HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("order", orderService.getById(Order.class, id));
		return "/admin/print/shipping";
	}
}
